1. Field of the Invention
The present invention relates to the field of mobile communications. More particularly, the present invention relates to a system and method for clock slew correction in serial transmission of AT commands to cellular telephones capable of receiving and transmitting data.
2. Related Art
In addition to voice transmission capabilities, cellular telephones now provide data services. A cellular telephone configured to receive and transmit data allows a user to remotely access the Internet, e-mail, facsimiles, and other data sources using a laptop computer and the cellular telephone. The data provided by the data source must be converted into signals appropriate for processing and transmission by the cellular telephone. Cellular telephones configured in accordance with time division multiple access (TDMA), frequency division multiple access (FDMA) or code division multiple access (CDMA) must convert the data to the appropriate format for their respective protocols.
To correctly process the data, the baud rate at which the data is transmitted to the cellular telephone (via data link such as serial port) must be determined. This process is referred to as autobauding. The cellular telephone must be able to identify the baud rate of the incoming data to effectively convert the data to the appropriate format for transmission.
To lessen power consumption and cut costs, universal asynchronous receive and transmit (UART) devices are used in cellular telephones to process incoming serial data. Usually these devices follow RS-232 protocol and only support the asynchronous portion of the standard. The UART operates in byte mode when the baud rate of the incoming data is known. In byte mode of operation, the UART automatically corrects for slew usually by means of phase locked loop hardware. In addition, the UART automatically strips off start and stop bits as well as checks parity (if any). Slew is the difference in clock rates between the transmitting clock and the receiving clock. The UART operates in sampling mode during autobaud. During autobaud, the UART, in QUALCOMM""s Mobile Station Modem, samples the incoming serial data at a higher rate to determine the baud rate. When the UART operates in sampling mode, it does not account for slew nor does it strip off start and stop bits. In sampling mode, the UART simply takes 8 samples and presents the eight samples as a byte. The UART is set to a bit-rate such that a byte (a group of eight samples) corresponds to a bit at the highest bit-rate which is detected by autobauding. A bit which is sampled can very well be a start bit or a stop bit. After the starting byte and the baud rate have been determined, the UART needs to be set to the byte mode of operation to receive the remaining characters of the incoming data stream. A problem may arise if the UART exits out of sampling mode when a portion of a character has already been read into the UART before exiting. After the UART exits out of sampling mode into byte mode, the UART attempts its normal operations of looking for a start bit and a stop bit, accounting for clock slew, etc. If a portion of a data character was in the UART at the time the UART transitioned from sampling mode to byte mode of operation, the UART may interpret an actual data character as a start bit. When this occurs, the data will look like garbage until the next command comes along. In order for the incoming data stream to be reliable, the UART needs to remain in sampling mode for the entire command. While the UART remains in sampling mode, clock slew must be accounted for, otherwise, the data will be lost or misinterpreted and eventually will look like garbage.
What is needed is a system and method for providing reliable data during serial communications that corrects for slew when the UART is operating in sampling mode during autobauding.
The present invention solves the above mentioned problem by providing a system and method for accounting for clock slew during autobauding. Upon identifying an AT command and a baud rate for the incoming data stream, the present invention accounts for clock slew in one of two ways, depending upon the baud rate of the incoming data stream.
If the baud rate of the incoming data stream is 9600 or greater, the present invention accounts for slew by utilizing a feature associated with ASCII characters and RS-232 protocol. The feature is the stop bit being nicely framed on both sides by spaces. This feature is used to determine whether negative or positive clock slew exists. If negative clock slew exists and it is determined that the value of negative clock slew falls outside of a certain threshold, a sample is skipped. If positive clock slew exists and its value falls outside of a certain threshold, positive clock slew is converted to negative clock slew by taking an extra sample. Clock slew is accounted for by reconstructing bits from an old sample and a new sample, based on the calculated slew value, to obtain an actual sample that eliminates the deleterious effects of clock slew.
When the baud rate of the incoming data stream is less than 9600, the present invention accounts for clock slew by reading a middle group of 8 samples from the start bit of a character when multiple groups of 8 samples per bit exist. This is accomplished by searching for the next start bit. Once the next start bit is found, it is determined which group of 8 samples is a middle sample. The present invention counts over to the middle sample and reads the data from the middle sample to negate the effects of slew.
Further features and advantages of the invention, as well as the structure and operation of various embodiments of the invention, are described in detail below with reference to the accompanying drawings.